﻿using System;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x02000011 RID: 17
	[Serializable]
	public class ConstraintPositionOffset : Constraint
	{
		// Token: 0x0600013F RID: 319 RVA: 0x00002F33 File Offset: 0x00001133
		public ConstraintPositionOffset()
		{
		}

		// Token: 0x06000140 RID: 320 RVA: 0x00002F3B File Offset: 0x0000113B
		public ConstraintPositionOffset(Transform transform)
		{
			this.transform = transform;
		}

		// Token: 0x06000141 RID: 321 RVA: 0x0001EA78 File Offset: 0x0001CC78
		public override void UpdateConstraint()
		{
			if (this.weight <= 0f)
			{
				return;
			}
			if (!base.isValid)
			{
				return;
			}
			if (!this.initiated)
			{
				this.defaultLocalPosition = this.transform.localPosition;
				this.lastLocalPosition = this.transform.localPosition;
				this.initiated = true;
			}
			if (this.positionChanged)
			{
				this.defaultLocalPosition = this.transform.localPosition;
			}
			this.transform.localPosition = this.defaultLocalPosition;
			this.transform.position += this.offset * this.weight;
			this.lastLocalPosition = this.transform.localPosition;
		}

		// Token: 0x1700000A RID: 10
		// (get) Token: 0x06000142 RID: 322 RVA: 0x00002F4A File Offset: 0x0000114A
		public bool positionChanged
		{
			get
			{
				return this.transform.localPosition != this.lastLocalPosition;
			}
		}

		// Token: 0x04000088 RID: 136
		public Vector3 offset;

		// Token: 0x04000089 RID: 137
		public Vector3 defaultLocalPosition;

		// Token: 0x0400008A RID: 138
		public Vector3 lastLocalPosition;

		// Token: 0x0400008B RID: 139
		public bool initiated;
	}
}
